package com.xx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller // 表示当前类为控制器
@RequestMapping // 默认访问路径
@ResponseBody   // 返回数据
public class UserController {
        @RequestMapping(value = "select",produces = "Application/json;charset=UTF-8")
        public String say(){
            System.out.println("select");
            return "查询用户";
        }

        @RequestMapping(value = "add",produces = "Application/json;charset=UTF-8")
        public String sayAdd(){
            System.out.println("ADD");
            return "新增用户";
        }

        @RequestMapping(value = "update",produces = "Application/json;charset=UTF-8")
        public String sayUpdate(){
            System.out.println("UPDATE");
            return "修改用户";
        }

        @RequestMapping(value = "del",produces = "Application/json;charset=UTF-8")
        public String sayDel(){
            System.out.println("DEL");
            return "删除用户";
        }
    @RequestMapping(value = "query",method = RequestMethod.GET)
    public List<String> query(String name, Integer sex) {
        System.out.println(name+"---"+sex);
        System.out.println("query");
        return null;
    }

    @RequestMapping(value = "queryId",method = RequestMethod.GET)
    public List<String> queryId(Integer id) {
        System.out.println(id);
        System.out.println("queryId");
        return null;
    }
}
